package cn.mumzone.pos.ui.adapter.warehouse;

import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import cn.mumzone.pos.ui.fragment.warehouse.FRA_OutWarehouse;
import cn.mumzone.pos.ui.fragment.warehouse.FRA_OutWarehouseItem;
import cn.mumzone.pos.ui.fragment.warehouse.FRA_WarehouseItem;

/**
 * Created By Dlx
 * on 2019/9/25
 */
public class ADA_OutWarehouseForVp extends FragmentPagerAdapter {

    private FRA_OutWarehouseItem all;
    private FRA_OutWarehouseItem lossess; //盘亏
    private FRA_OutWarehouseItem reportLoss; //报损
    private FRA_OutWarehouseItem other;

    public ADA_OutWarehouseForVp(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int i) {
        if (i == 0) {
            if (all == null) {
                all = FRA_OutWarehouseItem.newInstance(FRA_OutWarehouseItem.TYPE_ALL);
            }
            return all;
        }
        if (i == 1) {
            if (lossess == null) {
                lossess = FRA_OutWarehouseItem.newInstance(FRA_OutWarehouseItem.TYPE_GET_GOODS);
            }
            return lossess;
        }
        if (i == 2) {
            if (reportLoss == null) {
                reportLoss = FRA_OutWarehouseItem.newInstance(FRA_OutWarehouseItem.TYPE_PROFIT);
            }
            return reportLoss;
        }

        if (i == 3) {
            if (other == null) {
                other = FRA_OutWarehouseItem.newInstance(FRA_OutWarehouseItem.TYPE_OTHER);
            }
            return other;
        }
        return null;
    }

    @Override
    public int getCount() {
        return 4;
    }
    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {

    }

    @Override
    public void destroyItem(@NonNull View container, int position, @NonNull Object object) {

    }
}
